package wikiPhilia_two;

import java.util.ArrayList;
import java.util.Iterator;

import processing.core.PApplet;


public class reduceTSV extends PApplet{
	TsvWriterModule twm = new TsvWriterModule(this);
	String outputFileName = "Coby_Miller_complete_stuff_red.tsv";
	String inputFileName = "Coby_Miller_complete_stuff.tsv";
	TsvTable inputTable;
	BigFile bf;
	ArrayList<String> outputBuffer = new ArrayList<String>();
	int counter;
	public void setup() {
		try {
			bf = new BigFile(inputFileName);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Iterator<String> itr = bf.iterator();
		int counter = 0;
		while (itr.hasNext()) {
			String s = itr.next();
			System.out.println(s);
			
			for (int i = 0; i < outputBuffer.size(); i++) {
				if (!outputBuffer.contains(s)) outputBuffer.add(s);
			}
			System.out.println(counter);
			counter++;
		}
		
		
		twm = new TsvWriterModule(this);
		twm.init(outputFileName);
		for (int i = 0; i < outputBuffer.size(); i++) {
			String line = outputBuffer.get(i);
			String[] words = line.split("\t");
			words = new String[1];
			words[0] = line;
			twm.printStringRow(words);
			//twm.printStringRow(line);
		}
		twm.finish();
	}
}
